package com.rc.saas.mini.service.rc;

import com.rc.saas.mini.common.base.BaseMapper;
import com.rc.saas.mini.mapper.rc.RcMsgNotificationMapper;
import com.rc.saas.mini.model.rc.RcMsgNotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class RcMsgNotificationServiceImpl implements RcMsgNotificationService {
    @Autowired
    private RcMsgNotificationMapper rcMsgNotificationMapper;

    @Override
    public RcMsgNotificationMapper getMapper() {
        return rcMsgNotificationMapper;
    }

    @Override
    public void saveRcMsgNotification(RcMsgNotification rcMsgNotification) {
        //渠道商审核：/channel/apply/index
        //加盟商审核: /operator/index
        //企业审核: /enterpriseMemberApply/index
        //开票申请: /invoiceApply/index

        if ("0".equals(rcMsgNotification.getMsgType())) {
            rcMsgNotification.setMsgTitle("企业审核");
            rcMsgNotification.setMsgUrl("/enterpriseMemberApply/index");
        }
        if ("1".equals(rcMsgNotification.getMsgType())) {
            rcMsgNotification.setMsgTitle("加盟商审核");
            rcMsgNotification.setMsgUrl("/operator/index");
        }

        if ("2".equals(rcMsgNotification.getMsgType())) {
            rcMsgNotification.setMsgTitle("渠道商审核");
            rcMsgNotification.setMsgUrl("/channel/apply/index");
        }
        if ("3".equals(rcMsgNotification.getMsgType())) {
            rcMsgNotification.setMsgTitle("退款审核");
            rcMsgNotification.setMsgUrl("/orderRefundApply/index");
        }
        if ("4".equals(rcMsgNotification.getMsgType())) {
            rcMsgNotification.setMsgTitle("提现审核");
            rcMsgNotification.setMsgUrl("/memberRefundApply/index");
        }
        if ("5".equals(rcMsgNotification.getMsgType())) {
            rcMsgNotification.setMsgTitle("开票申请");
            rcMsgNotification.setMsgUrl("/invoiceApply/index");
        }
        if ("6".equals(rcMsgNotification.getMsgType())) {
            rcMsgNotification.setMsgTitle("评价审核");
            rcMsgNotification.setMsgUrl("/evaluate/index");
        }

        rcMsgNotification.setCreatedTime(new Date());
        rcMsgNotification.setIsRead("0");

        rcMsgNotificationMapper.insertSelective(rcMsgNotification);

    }
}
